Skip to content

fix: use first cwd as launch dir for worktree sessions#64

Open
gadflysu wants to merge 2 commits into
masterfrom
fix/62-claude-resume-launch-dir
Open

fix: use first cwd as launch dir for worktree sessions#64
gadflysu wants to merge 2 commits into
masterfrom
fix/62-claude-resume-launch-dir

Conversation

@gadflysu

Copy link
Copy Markdown
Owner

Summary

  • parseJSONL now returns both cwd (last non-empty, for display/filter) and launchDir (first non-empty, for launching)
  • Session gains a LaunchDir field; MetaEntry caches it
  • main.go passes LaunchDir (fallback CWD) to the launcher instead of CWD

Test plan

  • go test ./... passes (3 new tests: TestParseJSONL_LaunchDirIsFirstCWD, TestParseJSONL_LaunchDirEqualsDisplayCWD_WhenNoWorktreeChange, TestSession_LaunchDir_SetFromFirstCWD)
  • Non-worktree sessions unaffected (LaunchDir == CWD when cwd never changes)
  • Worktree session whose transcript tail cwd is .claude/worktrees/... resumes from the original project root

Closes #62

gadflysu added 2 commits June 23, 2026 16:53
Claude resolves transcript storage from the launch directory namespace.
When a session starts in the project root but later records move into a
.claude/worktrees/ path, the last-wins cwd caused aps to cd into the
worktree before resuming — making Claude search a namespace that holds
no transcript.

Fix: parseJSONL now returns both cwd (last non-empty, for display/filter)
and launchDir (first non-empty, for launcher.Claude). Session gains a
LaunchDir field; MetaEntry caches it. main.go passes LaunchDir to the
launcher instead of CWD. For sessions that never change directory,
LaunchDir == CWD so existing behavior is preserved.

Closes #62
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claude resume launch directory for worktree sessions

1 participant